package org.newgeekorder.engine;

public class GoldenRule {
	String [][] rulesData;
	String resultColumnStr;
	int resultColumnIndex;

	public void load(String[][] tableData) {
		rulesData = tableData;		
	}

	public void resultColumn(String resultStr) throws Exception {
		resultColumnStr = resultStr;
		int resultCol = getResultColumnIndex( resultStr);
	}

	private int getResultColumnIndex(String resultStr) throws Exception {
		int i = 0;
		while ( i < rulesData.length -1  ){
			if ( rulesData[0][i].equals(resultStr)){
				return i;
			}
		}
		throw new Exception("Specified result column value of \'" + resultStr + "\' not found" );
	}

	/**
	 * Simplistic matching, first optimisation we could concatante strings including generating all started (*) options
	 * @param value
	 * @return
	 */
	public String validate(String value ) {
		// do simplistic matching
		boolean match = false;
		int i = 0;
		while ( match != false && i < rulesData[0].length ){
			
		}
		
		return "Result";
		
	}

}
